<template>
	<view class="pages-box rel" v-if="isLoad">
		<!-- #ifndef H5 -->
		<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" title="服务人员入驻" leftIcon="icon-left" color="#ffffff"
			:backgroundColor="primaryColor">
		</uni-nav-bar>
		<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
		<!-- #endif -->
		<view class="page-height" v-if="[1,4].includes(status)">
			<abnor percent="150%" @confirm="confirm" @cancel="$util.goUrl({ url: 1, openType: `navigateBack` })"
				:title="title[status]" :tip="tipArr[status]" :button="buttonArr[status]" :image="image[status]"></abnor>
		</view>
		<block v-else>
			<view class="apply-form">
				<block v-if="form.company_id">
					<view class="pt-lg pb-md f-title text-bold pl-lg">公司信息</view>
					<view class="fill-base">
						<block v-if="is_update || is_boss">
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">公司名称</text>
								</view>
								<view class="item-input text text-bold">{{form.company_name}}</view>
							</view>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">所在城市</text>
								</view>
								<view class="item-input text text-bold">{{form.company_city}}</view>
							</view>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">公司客服</text>
								</view>
								<view class="item-input text text-bold">{{form.service_tel}}</view>
							</view>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">公司地址</text>
								</view>
								<view class="item-input text text-bold flex-1">
									<text style="display: inline-block;"
										class="pl-lg text-left">{{form.company_address}}</text>
								</view>
							</view>
						</block>
						<block v-else>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">上门类型</text>
								</view>
								<view class="item-input text flex-y-center">
									<view @tap.stop="changeType(index)" class="flex-y-center"
										:class="[{'mr-lg':index==0}]"
										:style="{color:searchForm.type == index ? primaryColor:''}"
										v-for="(item,index) in ['上门服务','上门回收']" :key="index"><i
											class="iconfont icon-xuanze mr-sm"
											:class="[{'icon-radio-fill':searchForm.type == index}]"></i>{{item}}
									</view>
								</view>
							</view>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="f-title">选择行业</text>
								</view>
								<view class="item-input text">
									<picker @change="pickerChange($event,'industry')" :value="industryIndex"
										:range="industryList" range-key="title">
										<view class="flex-y-center"
											:class="[{'c-caption':industryIndex==-1},{'text-bold':industryIndex!=-1}]">
											{{industryIndex!=-1?industryList[industryIndex].title:'请选择'}}
											<i class="iconfont icongengduo ml-sm"></i>
										</view>
									</picker>
								</view>
							</view>
							<view class="flex-between ml-lg mr-lg b-1px-b">
								<view class="item-text">
									<text class="c-warning">*</text>
									<text class="f-title">选择公司</text>
								</view>
								<view class="item-input text">
									<picker @change="pickerChange($event,'company')" :value="companyIndex"
										:range="companyList" range-key="title">
										<view class="flex-y-center"
											:class="[{'c-caption':companyIndex==-1},{'text-bold':companyIndex!=-1}]">
											{{companyIndex!=-1?companyList[companyIndex].title:'请选择'}}
											<i class="iconfont icongengduo ml-sm"></i>
										</view>
									</picker>
								</view>
							</view>
						</block>
					</view>
				</block>
				<view class="pt-lg pb-md f-title text-bold pl-lg">入驻信息</view>
				<view class="fill-base">
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">姓名</text>
						</view>
						<input v-model="form.name" type="text" class="item-input flex-1"
							:class="[{'text-bold':form.name}]" :placeholder="rule[1].errorMsg" />
					</view>
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">手机号</text>
						</view>
						<input v-model="form.mobile" type="number" class="item-input flex-1"
							:class="[{'text-bold':form.mobile}]" :placeholder="rule[2].errorMsg" />
					</view>
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">手机验证码</text>
						</view>
						<input v-model="form.code" type="number" class="item-input flex-1" maxlength="6"
							:class="[{'text-bold':form.code}]" :placeholder="rule[3].errorMsg" />
						<text @tap="getCode" class="obtain text-right"
							:style="{color: primaryColor}">{{authTime ?authTime :'获取' }}</text>
					</view>
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">生日</text>
						</view>
						<view class="item-input text">
							<picker @change="pickerChange($event,'birthday')" mode="date" :value="form.bir">
								<view class="flex-y-center" :class="[{'c-caption':!form.bir},{'text-bold':form.bir}]">
									{{form.bir||'请选择'}}
									<i class="iconfont icongengduo ml-sm"></i>
								</view>
							</picker>
						</view>
					</view>
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">性别</text>
						</view>
						<view class="item-input text flex-y-center">
							<view @tap.stop="form.sex = index" class="flex-y-center" :class="[{'mr-lg':index==0}]"
								:style="{color:form.sex == index ? primaryColor:''}" v-for="(item,index) in ['男','女']"
								:key="index"><i class="iconfont icon-xuanze mr-sm"
									:class="[{'icon-radio-fill':form.sex == index}]"></i>{{item}}
							</view>
						</view>
					</view>
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">工作城市</text>
						</view>
						<view class="item-input text" @tap="changeCity">
							<view class="flex-y-center" :class="[{'c-caption':!form.city},{'text-bold':form.city}]">
								{{form.city?form.city:'请选择'}}
								<i class="iconfont icongengduo ml-sm"></i>
							</view>
						</view>
					</view>
					<view class="flex-warp ml-lg mr-lg">
						<view class="item-input text" style="width:200rpx;text-align: left;">
							<text class="c-warning">*</text>
							<text class="f-title">所在地址</text>
						</view>
						<view class="item-input text flex-1">
							<view @tap.stop="toChooseLocation" class="flex-y-center">
								<view class="flex-1 text-right" :class="[{'text-bold':form.address}]">
									{{form.address || `点击右边图标设置`}}
								</view><i class="iconfont iconxiangdaodaoda ml-sm" :style="{color: primaryColor}"></i>
							</view>
						</view>
					</view>
				</view>

				<view class="fill-base mt-md">
					<view class="flex-between ml-lg mr-lg b-1px-b">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">身份证号</text>
						</view>
						<input v-model="form.id_code" type="text" class="item-input flex-1"
							:class="[{'text-bold':form.id_code}]" :placeholder="rule[7].errorMsg" />
					</view>
					<view class="flex-between ml-lg mr-lg">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">身份证照片</text>
						</view>
						<view class="item-input tips flex-1"></view>
					</view>
					<view class="flex-between ml-lg mr-lg pb-md">
						<upload @upload="imgUpload" :imagelist="form.id_card" imgtype="id_card" imgclass="md"
							text="身份证人像面" :imgsize="1" :pictureSize="5"></upload>
						<upload @upload="imgUpload" :imagelist="form.id_card_fan" imgtype="id_card_fan" imgclass="md"
							text="身份证国徽面" :imgsize="1" :pictureSize="5"></upload>
					</view>
					<view class="flex-between ml-lg mr-lg ">
						<upload @upload="imgUpload" :imagelist="form.id_card_people" imgtype="id_card_people"
							imgclass="md" text="手持身份证照片" :imgsize="1" :pictureSize="5"></upload>
					</view>
					<view class="item-input tips flex-1 ml-lg mr-lg" style="padding: 20rpx 0 20rpx 0">图片上传大小不超过5M
					</view>
				</view>
				<view class="fill-base mt-md">
					<view class="flex-between ml-lg mr-lg">
						<view class="item-text">
							<!-- <text class="c-warning">*</text> -->
							<text class="f-title">工作照</text>
						</view>
						<view class="item-input tips flex-1"></view>
					</view>
					<view class="flex-between ml-lg mr-lg ">
						<upload @upload="imgUpload" :imagelist="form.work_img" imgtype="work_img" text="上传图片"
							:imgsize="1" :pictureSize="5">
						</upload>
					</view>
					<view class="item-input tips flex-1 ml-lg mr-lg" style="padding: 0 0 20rpx 0;">图片建议尺寸: 216 *
						216，图片上传大小不超过5M
					</view>
				</view>

				<view class="fill-base mt-md">
					<view class="flex-between ml-lg mr-lg">
						<view class="item-text">
							<!-- <text class="c-warning">*</text> -->
							<text class="f-title">资格证书</text>
						</view>
						<view class="item-input tips flex-1"></view>
					</view>
					<view class="flex-between ml-lg mr-lg ">
						<upload @upload="imgUpload" @del="imgUpload" :imagelist="form.cert" imgtype="cert" text="上传图片" :imgsize="9"
							:pictureSize="5">
						</upload>
					</view>
					<view class="item-input tips flex-1 ml-lg mr-lg" style="padding: 0 0 20rpx 0;">图片上传大小不超过5M
					</view>
				</view>
				<view class="fill-base mt-md pb-lg" v-if="typeList.length > 0">
					<view class="flex-between ml-lg mr-lg">
						<view class="item-text">
							<text class="c-warning">*</text>
							<text class="f-title">可接服务分类</text>
							<text class="f-desc" v-if="configInfo.company_service_limit && form.company_id">（最多可选{{configInfo.company_service_limit}}个）</text>
						</view>
						<view class="item-input tips flex-1"></view>
					</view>
					<block v-for="(item,index) in typeList" :key="index">
						<view class="pt-md ml-lg mr-lg" v-if="item.children">
							<view class="f-min-title text-bold">{{item.name}}</view>
							<view class="flex-warp">
								<view v-for="(citem,cindex) in item.children" :key="cindex" @tap.stop="changeTag(citem.id)" 
								:style="{borderColor: form.service_limit.includes(citem.id) ? primaryColor : '#ccc', color: form.service_limit.includes(citem.id) ? `#fff` : `#333`,background: form.service_limit.includes(citem.id) ? primaryColor : `#fff` }"
								class="flex-center tag-item mr-md pl-md pr-md mt-md" >{{citem.name}}</view>
							</view>
						</view>
					</block>
				</view>
				<view class="fill-base mt-md pb-lg">
					<view class="flex-between ml-lg mr-lg ">
						<view class="item-text f-title">服务理念</view>
						<input :disabled="true" type="text" class="item-input flex-1" />
					</view>
					<view class="textarea-box ml-lg mr-lg radius-16">
						<textarea v-model="form.desc" class="item-textarea pd-lg f-paragraph c-title"
							style="height: 100rpx;" :class="[{'text-bold':form.desc}]" maxlength="100"
							placeholder="请输入服务理念" placeholder-class="c-caption" />
						<view class="text-right f-paragraph pb-lg pr-lg" style="color:#C8CDD3">
							{{form.desc.length>100?100:form.desc.length}}/100
						</view>
					</view>
				</view>
				<view class="fill-base mt-md pb-lg">
					<view class="flex-between ml-lg mr-lg ">
						<view class="item-text f-title">简介</view>
						<input :disabled="true" type="text" class="item-input flex-1" />
					</view>
					<view class="textarea-box ml-lg mr-lg radius-16">
						<textarea v-model="form.intro" class="item-textarea pd-lg f-paragraph c-title"
							:class="[{'text-bold':form.intro}]" maxlength="300" placeholder="请输入简介"
							placeholder-class="c-caption" />
						<view class="text-right f-paragraph pb-lg pr-lg" style="color:#C8CDD3">
							{{form.intro.length>300?300:form.intro.length}}/300
						</view>
					</view>
				</view>

			</view>
			
			<w-picker :visible.sync="showCity" @confirm="onConfirmCity" mode="region" :hideArea="true"
				:hideCounty="true"></w-picker>
			<view class="space-max-footer"></view>

			<fix-bottom-button @confirm="submit" borderRadius="8rpx" :text="[{text:'确认提交',type:'confirm',isAuth:false}]"
				bgColor="#fff">
			</fix-bottom-button>
		</block>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import siteInfo from '@/siteinfo.js';
	

	export default {
		
		data() {
			return {
				rule: [{
						name: "company_id",
						checkType: "isNotNull",
						errorMsg: "请选择公司"
					}, {
						name: "name",
						checkType: "isNotNull",
						errorMsg: "请输入姓名"
					}, {
						name: "mobile",
						checkType: "isMobile",
						errorMsg: "请输入手机号"
					}, {
						name: "code",
						checkType: "isNotNull",
						errorMsg: "请输入验证码"
					},
					{
						name: "bir",
						checkType: "isNotNull",
						errorMsg: "请选择生日"
					},
					{
						name: "city",
						checkType: "isNotNull",
						errorMsg: "请选择所在城市"
					},
					{
						name: "address",
						checkType: "isNotNull",
						errorMsg: "请选择所在地址"
					},
					{
						name: "id_code",
						checkType: "isIdCard",
						errorMsg: "请输入身份证号"
					},
					{
						name: "id_card",
						checkType: "isNotNull",
						errorMsg: "请上传身份证人像面"
					},
					{
						name: "id_card_fan",
						checkType: "isNotNull",
						errorMsg: "请上传身份证国徽面"
					},
					// {
					// 	name: "id_card_people",
					// 	checkType: "isNotNull",
					// 	errorMsg: "请上传手持身份证照片"
					// },
					// {
					// 	name: "work_img",
					// 	checkType: "isNotNull",
					// 	errorMsg: "请上传工作照"
					// },
					// {
					// 	name: "cert",
					// 	checkType: "isNotNull",
					// 	errorMsg: "请上传资格证书"
					// },
					{
						name: "service_limit",
						checkType: "isNotNull",
						errorMsg: "请选择可接服务"
					}
				],
				form: {
					company_id: '',
					name: '', // 名称
					bir: '',
					sex: 0, // 1男2女
					province: '', // 省
					city: '',
					address: '',
					id_code: '',
					id_card: [], //身份证
					id_card_fan: [], // 身份证反面
					id_card_people: [], //手持身份证
					work_img: '',
					cert: [],
					desc: '', // 服务理念
					intro: '',
					mobile: '',
					lat: '',
					lng: '',
					code: '',
					company_name: '',
					service_tel: '',
					company_city: '',
					company_address: '',
					service_limit: []
				},
				searchForm: {
					type: -1,
					industry: ''
				},
				industryIndex: -1,
				industryList: [],
				companyIndex: -1,
				companyList: [],
				showCity: false,
				lockTap: false,
				// 1待审核 2通过 4驳回
				tipArr: {
					'1': [{
						text: '审核中不可编辑资料',
						color: 0
					}],
					'2': [{
						text: '快去管理订单吧',
						color: 0
					}],
					'4': [{
						text: '请联系平台管理人员询问原因',
						color: 0
					}]
				},
				buttonArr: {
					'1': [{
						text: '返回',
						type: 'cancel'
					}],
					'2': [{
						text: '去管理',
						type: 'confirm'
					}],
					'4': [{
						text: '再次申请',
						type: 'confirm'
					}, {
						text: '个人中心',
						type: 'cancel'
					}]
				},
				title: {
					'1': '您已经成功提交申请',
					'2': `您已经通过了`,
					'4': '申请已驳回'
				},
				image: {
					'1': 'https://lbqny.migugu.com/admin/public/apply_wait.jpg',
					'2': 'https://lbqny.migugu.com/admin/public/apply_suc.jpg',
					'4': 'https://lbqny.migugu.com/admin/public/apply_fail.jpg'
				},
				is_update: 0,
				is_boss: 0,
				status: -1,
				coach_id: 0,
				isLoad: false,
				authTime: 0,
				timer: null,
				typeList: [],
				locationTap: false,
				isShow: false
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			location: state => state.user.location,
		}),
		async onLoad(options) {
			this.$util.showLoading()
			this.initIndex()
		},
		async onShow() {},
		async onReachBottom() {},
		methods: {
			...mapActions(['getConfigInfo']),
			async initIndex(refresh = false) {
				if (!this.configInfo.id || refresh) {
					this.getConfigInfo()
				}
				await this.getCoachInfo()
				this.getIndustryList()
				this.getCompanyList()
			},
			async getTypeList(id = 0){
				let data = await this.$api.pool.typeList({company_id: id})
				this.typeList = data
			},
			async getCoachInfo() {
				let data = await this.$api.user.coachInfo()

				if (data) {
					this.status = data && data.status || 1
					if (data.status == 4) {
						this.tipArr[4][0].text = data.sh_text
						this.is_update = 0
					}
					if (data.status == 2 || data.status == 3) {
						this.is_update = 1
					}
					if (data.is_update) {
						this.status = 1
					}

					data.work_img = data.work_img ? [{
						path: data.work_img
					}] : []
					data.cert = data.cert ? data.cert.split(',').map(item => {
						return {
							path: item
						}
					}) : []
					let id_card = data.id_card.split(',')
					data.id_card = id_card[0] ? [{
						path: id_card[0]
					}] : []
					data.id_card_fan = id_card[1] ? [{
						path: id_card[1]
					}] : []
					data.id_card_people = id_card[2] ? [{
						path: id_card[2]
					}] : []
					data.bir = this.$util.formatTime(data.bir * 1000, 'YY-M-D')
					data.sex = data.sex - 1
					data.service_limit = data.service_limit ? data.service_limit.split(',').map(item => {return item*1}) : []
					this.coach_id = data.id
					this.is_boss = data.is_boss
					for (let key in this.form) {
						this.form[key] = data[key]
					}
					this.getTypeList(data.company_id)
				}
				this.isLoad = true
				this.$util.hideAll()
			},
			changeTag(id){
				let {
					service_limit = []
				} = this.form
				
				let ind = service_limit.length > 0 ? service_limit.findIndex(item => {
					return item == id
				}) : -1
				if(ind == -1){
					if(this.configInfo.company_service_limit && service_limit.length == this.configInfo.company_service_limit && this.form.company_id){
						this.$util.showToast({title: `服务最多可接${this.configInfo.company_service_limit}个`})
						return
					}
					this.form.service_limit.push(id)
				}else{
					this.form.service_limit.splice(ind , 1)
				}
			},
			async getCode() {
				let {
					authTime
				} = this
				if (authTime) return
				let {
					mobile = ''
				} = this.form
				if (!mobile) {
					this.$util.showToast({
						title: '请输入手机号'
					});
					return;
				}
				let time = 60
				this.timer = setInterval(() => {
					if (time === 0) {
						clearInterval(this.timer)
						return
					}
					time--
					this.authTime = time
				}, 1000)
				await this.$api.base.sendShortMsg({
					phone: mobile,
					key: 'register'
				})
				this.$util.showToast({
					title: `验证码发送成功`
				})
			},
			onConfirmCity(e) {
				console.log(e)
				this.form.province = e.obj.province.label
				this.form.city = e.obj.city.label
			},
			changeCity() {
				this.showCity = true
			},
			pickerChange(e, key) {
				let val = e.target.value
				console.log(val)
				if (key === 'birthday') {
					let unix = this.$util.DateToUnix(val)
					if (unix > new Date(Math.ceil(new Date().getTime())) / 1000) {
						this.$util.showToast({
							title: `不能选择未来时间哦`
						})
						return
					}
					this.form.bir = val
					return
				} else if (key === 'industry' && val > -1) {
					this.industryIndex = val
					this.searchForm.industry = this.industryList[val].id
					this.getCompanyList()
				} else if (key === 'company' && val > -1) {
					this.companyIndex = val
					this.form.company_id = this.companyList[val].id
				}
			},
			changeType(index) {
				this.searchForm.type = index
				this.getCompanyList()
			},
			imgUpload(e) {
				let {
					imagelist,
					imgtype
				} = e;
				this.form[imgtype] = imagelist;
			},
			async getCompanyList() {
				let searchForm = this.$util.deepCopy(this.searchForm)
				searchForm.type = searchForm.type + 1
				let data = await this.$api.user.getCompanyList(searchForm)
				data.map((item, index) => {
					item.title = item.name
					if (this.coach_id && this.form.company_id == item.id) {
						this.companyIndex = index
					}
				})
				if (!this.coach_id) {
					this.form.company_id = ''
					this.companyIndex = -1
				} else if (this.companyIndex == -1) {
					this.form.company_id = ''
				}

				this.companyList = data
			},
			async getIndustryList() {
				let data = await this.$api.user.getIndustryList()
				data.map(item => {
					item.title = item.name
				})
				data.forEach((item, index) => {
					if (item.id == this.form.industry) {
						this.industryIndex = index
					}
				})
				this.industryList = data
				this.industryList.unshift({
					title: '全部',
					id: 0
				})
			},
			confirm() {
				this.status = -1
			},
			//表单验证
			validate(param) {
				let validate = new this.$util.Validate();
				this.rule.map(item => {
					let {
						name,
					} = item
					if(name == 'company_id' && this.is_update){
						validate.add(1, item);
					}else{
						validate.add(param[name], item);
					}
				})
				let message = validate.start();
				return message;
			},
			async submit() {
				console.log(this.form)
				let param = this.$util.deepCopy(this.form)
				let msg = this.validate(param);
				if (msg) {
					this.$util.showToast({
						title: msg
					});
					return;
				}
				param.sex = param.sex + 1
				let arr = ['id_card', 'id_card_fan', 'id_card_people', 'work_img']
				arr.map(item => {
					param[item] = param[item].length > 0 ? param[item][0].path : ''
				})
				param.id_card = param.id_card_people ? [param.id_card, param.id_card_fan, param.id_card_people] : [param.id_card, param.id_card_fan]
				param.cert = param.cert.length > 0 ? param.cert.map(item => {
					return item.path
				}) : ''
				if(!param.work_img){
					param.work_img =  this.configInfo.coach_avatar || 'https://lbqny.migugu.com/admin/jiazheng/work_img.png'
				}
				param.bir = this.$util.DateToUnix(param.bir)
				delete param.id_card_fan
				delete param.id_card_people
				delete param.company_name
				delete param.company_city
				delete param.company_address
				delete param.service_tel
				this.$util.showLoading()
				if (this.lockTap) return
				this.lockTap = true
				try {
					let methodModel = this.is_update ? 'updateCoach' : 'applyCoach'
					await this.$api.user[methodModel](param)

					this.$util.showToast({
						title: `提交成功`,
					})
					setTimeout(() => {
						this.lockTap = false
						if (getCurrentPages().length > 1) {
							this.$util.back()
						}
						this.$util.goUrl({
							url: '/pages/mine',
							openType: `reLaunch`
						})
					}, 2000)
				} catch (e) {
					setTimeout(() => {
						this.lockTap = false
						this.$util.hideAll()
					}, 2000)
				}
			},
			// 选择地区
			async toChooseLocation(e) {
				await this.$util.checkAuth({
					type: 'userLocation'
				})
				if(this.locationTap) return
				this.locationTap = true
				let {
					lat: locaLat = '',
					lng: locaLng = ''
				} = this.location
				let {
					id = 0,
						lat: addrLat,
						lng: addrLng
				} = this.form

				if (id) {
					locaLat = addrLat
					locaLng = addrLng
				}

				let param = {
					latitude: locaLat,
					longitude: locaLng
				}
				if (!locaLat && !locaLng) {
					// #ifdef H5
					if (this.$jweixin.isWechat()) {
						this.$util.showLoading()
						await this.$jweixin.wxReady2();
						let {
							latitude,
							longitude
						} = await this.$jweixin.getWxLocation()
						locaLat = latitude
						locaLng = longitude
					}
					// #endif
					// #ifdef APP-PLUS
					let location = await this.$util.getBmapLocation()
					locaLat = location.lat
					locaLng = location.lng
					// #endif
				}

				// #ifndef MP-WEIXIN
				param = {
					latitude: locaLat,
					longitude: locaLng
				}
				// #endif
				let [, {
					address = '',
					longitude,
					latitude
				}] = await uni.chooseLocation(param);
				this.locationTap = false
				if (!address) return
				this.form.address = address
				this.form.lng = longitude
				this.form.lat = latitude
			}
		},
	}
</script>


<style lang="scss">
	.pages-box {
		.page-height {
			width: 100%;
			height: 100vh;
			background: #fff;
		}

		.apply-form {

			.item-input {
				padding: 25rpx 0;
				font-size: 32rpx;
				color: #222;
				min-height: 76rpx;
				line-height: 40rpx;
				text-align: right;

				.iconfont {
					font-size: 40rpx
				}

				.icongengduo {
					font-size: 24rpx;
					color: #9B9B9B;
				}
			}

			.item-input.text {
				padding: 42rpx 0;
			}

			.item-input.tips {
				text-align: left;
				font-size: 26rpx;
				color: #999;
			}

			.textarea-box {
				width: 690rpx;
				background: #F7F8FA;

				.item-textarea {
					color: #333;
					height: 280rpx;
				}
			}

			.icongengduo {
				font-size: 24rpx;
				color: #9B9B9B;
			}

			.service-list {
				.list-item {
					min-width: 168rpx;
					height: 68rpx;
					padding: 0 20rpx;
					color: #4A4A4A;
					background: #F6F7F8;
					border-radius: 34rpx;
				}

				.list-item.abs {
					opacity: 0.1;
					border-radius: 34rpx;
					top: 0;
					left: 0;
					right: 0;
					bottom: 0;
					z-index: 1;
				}
			}
		}

		.obtain {
			width: 88rpx;
		}
		
		.tag-item{
			min-width: 120rpx;
			height: 60rpx;
			border-radius: 60rpx;
			border: 1px solid;
		}
	}
</style>